package com.study.sqlSession;

import com.study.pojo.Configuration;

import java.util.List;

public interface SqlSession {
    /**
     * 查询多条数据
     * @param statementId
     * @param args
     * @param <E>
     * @return
     */
    <E> List<E> selectList(String statementId, Object args) throws Exception;

    /**
     * 查询单条数据
     * @param statementId
     * @param args
     * @param <T>
     * @return
     */
    <T> T selectOne(String statementId, Object args) throws Exception;

    /**
     * 新增
     * @param statementId
     * @param args
     * @return
     * @throws Exception
     */
    int insert(String statementId, Object args) throws Exception;

    /**
     * 更改
     * @param statementId
     * @param args
     * @return
     * @throws Exception
     */
    int update(String statementId, Object args) throws Exception;

    /**
     * 删除
     * @param statementId
     * @param args
     * @return
     * @throws Exception
     */
    int delete(String statementId, Object args) throws Exception;

    /**
     * 获取代理对象
     * @param type
     * @param <T>
     * @return
     * @throws Exception
     */
    <T> T getMapper(Class<T> type) throws Exception;

    Configuration getConfiguration();
}
